/**************************************************************************(C)*
 *
 *  This file is part of the GreenHills project
 *  Copyright (C) 2009  TietoEnator
 *
 *  This program is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************(C)*/

#pragma once

#include <QtCore/QTime>
#include <QtGui/QWidget>

#include "../gps/gpsposition.h"
#include "../gps/gpsfix.h"

namespace Ui {
    class CGPSTestWidget;
}

namespace gps {
class CNMEAParser;
} //namespace gps

namespace util {
    class CLineTerminal;
    class CSerialPort;
} //namespace util

namespace client {

class CGPSTestWidget : public QWidget {
    Q_OBJECT

public:
    CGPSTestWidget(util::CSerialPort * pSerialPort,
        util::CLineTerminal *pLineTerminal, gps::CNMEAParser *pNmeaParser,
        QWidget *pParent = 0);
    ~CGPSTestWidget();

private:
    Ui::CGPSTestWidget *mUi;
    util::CSerialPort *mSerialPort;
    util::CLineTerminal *mLineTerminal;
    gps::CNMEAParser *mNmeaParser;

public Q_SLOTS:
    void on_pushButtonOpen_clicked();
    void on_pushButtonClose_clicked();

    void onLineReceived(const QString &pLine);

    void onGPGGAreceived(const QTime &pTime,
        const gps::CGPSPosition &pPosition, const gps::CGPSFix &pFix,
        int pSatelites, float hdop, float pAltitude, float pGeoidHeight,
        float pDgpsUpdateDelay, int pDgpsStationId);

    void onGPVTGreceived(float pHeadingTrueNorth, float pHeadingMagnetic,
        float pSpeedInKnots, float pSpeedInKilometers);
};

} //namespace client
